package com.example.shirotest.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.shirotest.entry.Sites;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface SitesMapper extends BaseMapper<Sites> {

    @Select("SELECT GROUP_CONCAT(id) ids FROM sites WHERE state=1")
    String selectIdsOfActive();

    @Select("SELECT * FROM sites WHERE sid=#{sid} ORDER BY id DESC LIMIT 100")
    ArrayList<Sites> selectBySid(Integer sid);

    @Select("SELECT * FROM sites")
    List<Sites> selectAll();

}
